package com.neusoft.chenhanhua.ChineseChess;

public class Shi {
	public boolean shi(int x1,int y1,int x2,int y2, int i,int [] xs,int [] ys) {
		if (i<16) {
			if (y2<4 && 3<x2 && x2<7 && ((y2-y1==1 && x2-x1==1) || (y1-y2==1 && x1-x2==1) || (y2-y1==1 && x1-x2==1) || (y1-y2==1 && x2-x1==1)) ) {
				boolean wq=you(x1, y1, x2, y2, i, xs, ys);
				return wq;
			} 
		}else {
			if (y2>7 && 3<x2 && x2<7 && ((y2-y1==1 && x2-x1==1) || (y1-y2==1 && x1-x2==1) || (y2-y1==1 && x1-x2==1) || (y1-y2==1 && x2-x1==1)) ) {
				boolean we=you(x1, y1, x2, y2, i, xs, ys);
				return we;
			} 
		}
		return false;
	}
     public boolean you(int x1,int y1,int x2,int y2, int i,int [] xs,int [] ys) {
    	for (int j = 0; j < ys.length; j++) {
    		//判断有棋子就不能占
			if (x2==xs[j]&&y2==ys[j]) {
				return false;
			}
		}
    	return true;
     }
}
